/* Check JER_Bitmatrix::Inverse(). 
   reed_sol... already checked. */
#include <stdio.h>
#include "jerasure.h"
#include "reed_sol.h"

int main( int argc, char** argv )
{
	int *old_bitmatrix;
	int *bitmatrix;
	int *inverse_matrix;
	int i, j;
	int m = atoi( argv[1] );
	int k = atoi( argv[2] );
	int w = atoi( argv[3] );
	
	inverse_matrix = (int*) malloc( sizeof(int) * k*w * k*w );
	old_bitmatrix = reed_sol_extended_vandermonde_matrix( k, k, w );
	bitmatrix = jerasure_matrix_to_bitmatrix( k, k, w, old_bitmatrix );
	if( bitmatrix != NULL )
		jerasure_print_bitmatrix( bitmatrix, k*w, k*w, w );
	fprintf( stdout, "----------\n" );
	jerasure_invert_bitmatrix( bitmatrix, inverse_matrix, k*w );
	if( inverse_matrix != NULL )
		jerasure_print_bitmatrix( inverse_matrix, k*w, k*w, w );

	return 0;
}
